-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Bug in to_datetime raising ValueError with None and NaT and more than 50 elements #41006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
def test_convert_object_to_datetime_with_cache(self): | ||
# GH#39882 | ||
ser = pd.Series( | ||
[None] + [pd.NaT] * 50 + [pd.Timestamp("2012-07-26")], dtype="object" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could make 50 parameter in tools.datetimes, ensures that the test stays valid even if that gets changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Like this?
@@ -225,3 +227,16 @@ def test_convert_bool_dtype(self): | |||
# GH32287 | |||
df = pd.DataFrame({"A": pd.array([True])}) | |||
tm.assert_frame_equal(df, df.convert_dtypes()) | |||
|
|||
def test_convert_object_to_datetime_with_cache(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this with the other to_datetime tests: pandas/tests/tools/test_to_datetime.py; there a number of caching tests if you can locate nearby
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved, hope the location is ok, cache tests are everywhere there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep lgtm. lots of tests :->
@jreback greenish |
thanks @phofl |
None and NaT are different for unique while convert_listlike casts None to NaT, hence causing dups
Not sure if we could do something better.